<?php
/**
 * True Gallery back-end import template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename admin.upload.import.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2009 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');

?>
<script type="text/javascript">
function BatchFormCheck(theForm) {
	if( theForm.catid.value == '0' ) {
		alert('<?php echo JText::_ ( 'TG_ONE_ERR' ); ?>');
		return false;
	} else if ( theForm.gentitle.value == '' ) {
		alert('<?php echo JText::_ ( 'TG_TWO_ERR' ); ?>');
		return false;
	} else {
		dgLoading();
	}
}

var xmlhttp;
try{xmlhttp = new XMLHttpRequest();}catch(e){
try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){
try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
function dgLoading() {
if(!xmlhttp)return alert("No Http Transport.");
xmlhttp.open("GET",document.location.href,true);
xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == 4) {
		document.getElementById("status").innerHTML = '<img src="<?php echo TG_IMAGESWAY; ?>loading.gif" border="0" align="absmiddle">'
	}
}
xmlhttp.send(null);}
</script>
<?php echo JTrueGalleryHTMLHelper::linkJSCalendar(); ?>

<table class="adminheading">
	<tr><th class="tg_adminheader tg_unpack"><?php echo JText::_('TG_INSTALL_BI'); ?></th></tr>
</table>

<table class="adminform" border="0">
	<tr><th><?php echo JText::_ ( 'TG_IMPORT_ZIP' ); ?></th></tr>
</table>

<form action="index2.php?task=batchimporthandler" method="post" name="adminForm" enctype="'multipart/form-data" onSubmit="return BatchFormCheck(this)">
	<table width="100%" border="0" cellpadding="4" cellspacing="2" class="adminform">
		<tr align="center" valign="middle">
			<td align="center" valign="top">
				<input type="hidden" name="option" value="<?php echo TG_CMP; ?>" />
				<table border="0" width="100%">
					<tr>
						<td align="right"><strong><?php echo JText::_('TG_GENERIC_TITLE'); ?>:</strong></td>
						<td>
							<input type="text" name="gentitle" size="34" maxlength="256" /><?php echo mosToolTip( JText::_('TG_GENERIC_TITLE_BI_I')); ?>
						</td>
					</tr>
					<tr>
						<td width="20%" align="right"><strong><?php echo JText::_('TG_CAT_PHOTO_ASS');?>:</strong></td>
						<td><?php
//
$catid = $app->getUserStateFromRequest ( "catid{$option}", 'catid', 0 );
$categories[] = mosHTML::makeOption( '0', JText::_( 'TG_SELECT_CAT' ) );
$db->setQuery ( "SELECT id AS value, title AS text FROM #__categories" . "\nWHERE section='".TG_CMP."' ORDER BY ordering" );
$categories = array_merge( $categories, $db->loadObjectList() );
$clist = mosHTML::selectList( $categories, 'catid', 'class="inputbox" size="1" style="width:228;"', 'value', 'text', $catid );
$clist = JTrueGalleryHTMLHelper::showDropDownCategoryList( 0, 'catid', ' class="inputbox" size="1" style="width:228;"' );
echo $clist.''.mosToolTip( JText::_('TG_ALLOWED_CAT') ); ?>
						</td>
					</tr><?php
				if( $ad_field1 ) { ?>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD1'); ?>:</b></td>
						<td>
							<input class="inputbox" type="text" name="field1" id="field1" size="34" maxlength="100" value="" />
							<input type="reset" class="button" value="..." onClick="return showCalendar('field1', 'y-mm-dd');">
						</td>
					</tr><?php
				}
				if( $ad_field2 ) { ?>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD2'); ?>:</b></td>
						<td>
							<input class="inputbox" type="text" name="field2" size="34" maxlength="100" value="" />
						</td>
					</tr><?php
				}
				if( $ad_field3 ) { ?>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD3'); ?>:</b></td>
						<td>
							<input class="inputbox" type="text" name="field3" size="34" maxlength="100" value="" />
						</td>
					</tr><?php
				}
				if( $ad_field4 ) { ?>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD4'); ?>:</b></td>
						<td>
							<input class="inputbox" type="text" name="field4" size="34" maxlength="100" value="" />
						</td>
					</tr><?php
				}
				if( $ad_field5 ) { ?>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_FIELD5'); ?>:</b></td>
						<td>
							<input class="inputbox" type="text" name="field5" size="34" maxlength="100" value="" />
						</td>
					</tr><?php
				}
				?>
					<tr>
						<td align='right'><b><?php echo JText::_('TG_GENERIC_DESC'); ?>:</b></td>
						<td>
							<textarea class="inputbox" cols="25" rows="5" name="gendesc"></textarea> 
							<?php echo mosToolTip( JText::_('TG_OPT') ); ?>
						</td>
					</tr>
					<tr>
						<td align="right"><b><?php echo JText::_('TG_AUTHOR'); ?>:</b></td>
						<td><input type="text" name="photocred" size="34" maxlength="256"> <?php echo mosToolTip( JText::_ ( 'TG_OPT' ) ); ?></td>
					</tr>
						<td  align="right"><b><?php echo JText::_('TG_TAGS'); ?>:</b></td>
						<td><input class="inputbox" type="text" name="tags" size="34" maxlength="100" value="" /></td>
					</tr>
					<tr>
						<td></td>
						<td colspan="2" align="center">
							<br />
							<div id="status"><input type="submit" value="<?php echo JText::_('TG_ZIP_IMPORT'); ?>" class="button" />
							</div>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>